home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <dos.h>
- #include <dir.h>
- main()
- {
- int count;
- long totalsize;
- struct ffblk fileinfo;
- if( findfirst("*.c", &fileinfo, 0) == -1)
- {
- printf("Unsuccessful findfirst call!\n");
- exit(0);
- }
- printf("Listing of *.c files:\n");
- printf("%12s %8ld bytes\n", fileinfo.ff_name,
- fileinfo.ff_fsize);
- count =1;
- totalsize = fileinfo.ff_fsize;
- while(findnext(&fileinfo) == 0)
- {
- count++;
- totalsize += fileinfo.ff_size;
- /* Now print the name and size of each matching file */
- printf("%12s %8ld bytes\n",
- fileinfo.ff_name, fileinfo.ff_fsize);
- }
- printf("\n%d files %ld bytes.\n", count, totalsize);
- }
-